/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Trabalho3.RegrasPasswordChecker02;

import Trabalho3.RuleFactory;

/**
 *
 * @author geraldo
 */
public class RegraBonusNaoLiteraisIntermediarios implements RuleFactory{
     String password;
     private final int FATOR_BONUS_NAO_LITERAIS_INTERMEDIARIOS = 2;

    public RegraBonusNaoLiteraisIntermediarios(String password) {
        this.password = password;
    }
     

    @Override
    public int calcularRegra() {
     return this.somarNaoLiteraisIntermediarios()* FATOR_BONUS_NAO_LITERAIS_INTERMEDIARIOS;
    }
     
    public int somarNaoLiteraisIntermediarios() {
        char[] senha = password.toCharArray();
        int total = 0;
        for (int i = 1; i < (senha.length - 1); i++) {
            if (new Simbolos().isSimbol(senha[i]) || Character.isDigit(senha[i])) {
                total++;
            }
        }
        return total;
    } 
     
     
     
     
}
